import request from '@/utils/request'
import qs from 'qs'
import { jdyadmin } from '@/settings'

/**
 * 仓库管理
 */
// 根据分类id获取商品
export function productOneClass(data){
  return request({
    url: `${jdyadmin}/stockGoods/stockgoodslist`,
    method: 'get',
    params: data
  })
}
// 获取总分类列表
export function getCangku(data){
  return request({
    url: `${jdyadmin}/warehouseDepository/seleteCatalog`,
    method: 'post',
    data
  })
}

// 新增一级分类
export function addOneClassify(data){
  return request({
    url: `${jdyadmin}/warehouseDepository/addWarehouseAccess`,
    method: 'post',
    data
  })
}

// 更新一级分类
export function updateCangku(data){
  return request({
    url: `${jdyadmin}/warehouseDepository/updateWarehouseAccess`,
    method: 'post',
    data
  })
}

// 删除一级分类
export function deleteCangku(id){
  return request({
    url: `${jdyadmin}/warehouseDepository/deleteWarehouseAccess/${id}`,
    method: 'delete'
  })
}

// 新增二级分类
export function addTwoClassify(data){
  return request({
    url: `${jdyadmin}/warehouseGoods/addWarehouseAccess`,
    method: 'post',
    data
  })
}

// 更新二级分类
export function updateTwoClassify(data){
  return request({
    url: `${jdyadmin}/warehouseGoods/updateWarehouseAccess`,
    method: 'post',
    data
  })
}

// 删除二级分类
export function deleteTwoClassify(id){
  return request({
    url: `${jdyadmin}/warehouseGoods/deleteWarehouseAccess/${id}`,
    method: 'delete'
  })
}

// 新增商品
export function addProduct(data){
  return request({
    url: `${jdyadmin}/warehouseSpecs/addWarehouseAccess`,
    method: 'post',
    data
  })
}

// 更新商品
export function updateProduct(data){
  return request({
    url: `${jdyadmin}/warehouseSpecs/updateWarehouseAccess`,
    method: 'post',
    data
  })
}

// 删除商品
export function deleteProduct(id){
  return request({
    url: `${jdyadmin}/warehouseSpecs/deleteWarehouseAccess/${id}`,
    method: 'delete'
  })
}

// 更新




// 根据分类id查询商品
export function withIdGetPro(data){
  return request({
    url: `${jdyadmin}/warehouseSpecs/seleteWarehouseAccess`,
    method: 'post',
    data
  })
}

// 入库操作
export function inStock(data){
  return request({
    url: `${jdyadmin}/warehouseSpecs/inputWarehouseAccess`,
    method: 'post',
    data
  })
}

// 出库操作
export function outStock(data){
  return request({
    url: `${jdyadmin}/warehouseSpecs/outputWarehouseAccess`,
    method: 'post',
    data
  })
}


/**
 * 盘点单
 */
// 查询盘点单(暂时用不到)
export function getPandian(data){
	return request({
		url: `${jdyadmin}/warehouseCheck/seleteWarehouseAccess`,
		method: 'post',
		data
	})
}

// 查询盘点表头
export function getPandianTitle(data){
	return request({
		url: `${jdyadmin}/warehouseCheckTitle/seletetitleAccess`,
		method: 'post',
		data
	})
}

// 根据id查询盘点单
export function getPandianAll(data){
	return request({
		url: `${jdyadmin}/warehouseCheckTitle/seleteWarehouseTitleAccess`,
		method: 'post',
		data
	})
}


// 新增盘点单(暂时用不到)
export function addPandian(data){
	return request({
		url: `${jdyadmin}/warehouseCheck/addWarehouseAccess`,
		method: 'post',
		data
	})
}

// 新增盘点单
export function addPandianAll(data){
	return request({
		url: `${jdyadmin}/warehouseCheckTitle/addAllWarehouseAccess`,
		method: 'post',
		data
	})
}

// 正常传参新增盘点单
export function addZcPandian(data){
	return request({
		url: `${jdyadmin}/warehouseCheck/zhengchangaddlistWarehouseAccess`,
		method: 'post',
		data
	})
}

// 更新盘点单(最新)
export function updatePandian(data){
	return request({
		url: `${jdyadmin}/warehouseCheckTitle/updateAllWarehouseAccess`,
		method: 'post',
		data
	})
}

// 删除盘点单(用不到)
export function deletePandian(id){
	return request({
		url: `${jdyadmin}/warehouseCheck/deleteWarehouseAccess/${id}`,
		method: 'delete'
	})
}


// 删除盘点单
export function deletePandianNew(id){
	return request({
		url: `${jdyadmin}/warehouseCheckTitle/deleteAllhouseAccess/${id}`,
		method: 'delete'
	})
}